package cs301.msflags;

import cs301.game.GameAction;

/**
 * @author John Olennikov
 * @author Kyanne Mayfield
 * @author Allie Seibert
 * @author Emilia Holbik
 * @version 12/7/2012
 * 
 *          This action indicates that a player wants to end his or her turn and
 *          allow the other player to take his or her turn.
 */

public class MSFlagsEndTurnAction extends GameAction {
	
	/**
	 * A copy of the current Board
	 */
	
	Board board;
	
	/**
	 * Number of flags available to the player
	 */
	
	int playerFlags;
	
	/**
	 * Whether or not a player has uncovered a mine and the game should prepare
	 * to end
	 */
	
	boolean hasUncoveredMine;

	/**
	 * Calls the constructor in GameAction class and updates who performed this
	 * action.
	 * 
	 * @param source: initializes source of action
	 * @param board: the valid current Board object
	 * @param flagsRemaining: number of flags left that the user can place on 
	 *        the board
	 * @param uncoveredMine: whether or not the user has uncovered a mine
	 */

	public MSFlagsEndTurnAction(int source, Board board, int flagsRemaining, 
			boolean uncoveredMine) {
		super(source);
		this.board = board;
		this.playerFlags = flagsRemaining;
		this.hasUncoveredMine = uncoveredMine;
	}
	
	/**
	 * @return  the updated copy of the Board
	 */
	public Board getBoard()
	{
		return this.board;
	}
	
	/**
	 * @return  the updated number of flags left to put on the Board
	 */
	public int getFlagsRemaining()
	{
		return this.playerFlags;
	}
	
	/**
	 * @return  whether or not the user has uncovered a mine
	 */
	public boolean getUncoveredMine()
	{
		return hasUncoveredMine;
	}

}
